package chap3_7;

import java.io.*;

/**
 * @author https://gitee.com/W_Jun
 * @date 2021-12-13 20:58
 * @Description
 */
public class CopyJavaDemo01 {
    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(new FileInputStream("chapter03-字符流\\src\\chap3_4\\ConversionStreamDemo.java"));
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("chapter03-字符流\\Copy.java"));
        //一次读写一个字符
/*        int ch;
        while ((ch = isr.read()) != -1) {
            osw.write(ch);
        }
        osw.close();
        isr.close();
*/
        //一次读写一个字符数组
        char[] chs = new char[1024];
        int len;
        while ((len = isr.read(chs)) != -1) {
            osw.write(chs, 0, len);
        }
        osw.close();
        isr.close();

    }
}
